'''
冒泡排序
'''
def bubble_sort(list):
    n = len(list)
    for i in range(n - 1):
        count = 0
        for j in range(n - 1 - i):
            if list[j] > list[j + 1]:
                list[j], list[j + 1] = list[j + 1], list[j]
                count += 1
        if count < 1:
            # 顺序未变动 所有数据已有序
            print('is ordered')
            break
    print(list)


if __name__ == '__main__':
    bubble_sort([29, 24, 25])
    # bubble_sort([22, 24, 25])
